package game;

import java.awt.Graphics2D;
import java.awt.Point;

public class Button extends GameObject {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int imgSelected;
	public int firstImage;
	public GameObject message;
	
	public Button(Point position, Point size, int firstImage, int imgSelected, GameObject message) {
		super(position, size);
		this.imgSelected = imgSelected;
		this.firstImage = firstImage;
		this.message = message;
		this.setImage(firstImage);
	}
	@Override
	public void Update() 
	{
		if(this.getRectangle().contains(Mouse.getInstance().getPositionMouse()))
			setImage(imgSelected);
		else
			setImage(firstImage);
		
		super.Update();
	}
	@Override
	public void draw(Graphics2D g2d) {
		// TODO Auto-generated method stub
		
		super.draw(g2d);
		
		if(this.getRectangle().contains(Mouse.getInstance().getPositionMouse()))
				{
					if(message != null)
					{
						message.draw(g2d);	
					}
				}
		
	}
}
